/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.ufrn.dimap.projetodetalhadodesoftware.chatrmi.model.actor;

import br.ufrn.dimap.projetodetalhadodesoftware.chatrmi.model.actor.ChatModel;
import br.ufrn.dimap.projetodetalhadodesoftware.chatrmi.model.observer.Observer;
import br.ufrn.dimap.projetodetalhadodesoftware.chatrmi.model.observer.Subject;
import br.ufrn.dimap.projetodetalhadodesoftware.chatrmi.controller.ChatControllerInterface;
import br.ufrn.dimap.projetodetalhadodesoftware.chatrmi.controller.ChatInterface;
import br.ufrn.dimap.projetodetalhadodesoftware.chatrmi.controller.ClientInterface;
import br.ufrn.dimap.projetodetalhadodesoftware.chatrmi.model.register.Register;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.Iterator;
import br.ufrn.dimap.projetodetalhadodesoftware.chatrmi.model.util.Message;

/**
 *
 * @author logan
 */
public class ServerModel {

   

    private Integer id;
    private ArrayList<ChatControllerInterface> chatList;
    private Integer indexOfClients;


    public ServerModel() throws RemoteException {
        this.id = id;
        this.chatList = new ArrayList<ChatControllerInterface>();
    }

   
    public ArrayList<ChatControllerInterface> getChatList() {
        return chatList;
    }

    public void setChatList(ArrayList<ChatControllerInterface> chatList) {
        this.chatList = chatList;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getIndexOfClients() {
        return indexOfClients;
    }

    public void setIndexOfClients(Integer indexOfClients) {
        this.indexOfClients = indexOfClients;
    }

    public void insertChat( ChatControllerInterface chat){
        chatList.add(chat);
    }

    public void removeChat( Integer id) throws RemoteException{

        for(int i = 0; i < chatList.size(); i++){
            if(chatList.get(i).getId() == id){
                chatList.remove(i);
                return;
            }
        }
    }

   

}
